import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.geom.Rectangle2D;

public class Rectangle implements IShape {
    Point ptTopLeft;
    int width, height;

    public Rectangle(Point ptTopLeft, int width, int height) {
        this.ptTopLeft = ptTopLeft;
        this.width = width;
        this.height = height;
    }

    @Override
    public double perimeter() {
        return 2 * (width + height);
    }

    @Override
    public double area() {
        return width * height;
    }

    @Override
    public void draw(Graphics g) {
        Graphics2D g2d = (Graphics2D) g;
        Rectangle2D rect = new Rectangle2D.Double(ptTopLeft.x, ptTopLeft.y, width, height);
        g2d.draw(rect);
    }
}